package org.example.service.impl;

import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import lombok.extern.slf4j.Slf4j;
import org.example.entity.Test;
import org.example.entity.TestData;
import org.example.entity.TestJobData;
import org.example.service.JobService;
import org.example.service.TestDataService;
import org.example.service.TestJobDataService;
import org.example.service.TestJobService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author yangzhenyu
 * @version 1.0
 * @description:
 * @date 2023/4/27 18:54
 */
@Service
@Slf4j
public class JobServiceImpl implements JobService {
    @Autowired
    TestDataService testDataService;
    @Autowired
    TestJobDataService testJobDataService;
    @Autowired
    TestJobService testJobService;
    @DSTransactional
    @Override
    public void etl(List<Test> searchParam) {
        List<TestData> data = testDataService.setData(searchParam);
        testDataService.saveBatch(data);
    }

    @Override
    public void saveBatch(List<TestJobData> searchParam) {
        testJobDataService.saveBatch(searchParam);
    }

}
